using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter05
{
	/// <summary>
	/// Example01: An Accelerating Hockey Puck
	/// A hockey puck having a mass of 0.30 kg slides on the 
	/// horizontal, frictionless surface of an ice rink. 
	/// Two hockey sticks strike the puck simultaneously, 
	/// exerting the forces on the puck shown in Figure 5.4. 
	/// The force F_1 has a magnitude of 5.0 N with -20^{\circle}, 
	/// and the force F_2 has a magnitude of 8.0 N with 60^{\circle}. 
	/// Determine both the magnitude and the direction of 
	/// the puck's acceleration.
	/// a = 34 m/s^2
	/// \theta = 30^{\circle}
	/// </summary>
	public class Example01
	{
		public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Force[] f = new L.Force[2];
			f[0] = new L.Force();
			f[0].X = 5.0*Math.Cos(-20.0*Math.PI/180.0);
			f[0].Y = 5.0*Math.Sin(-20.0*Math.PI/180.0);
			f[1] = new L.Force();
			f[1].X = 8.0*Math.Cos(60.0*Math.PI/180.0);
			f[1].Y = 8.0*Math.Sin(60.0*Math.PI/180.0);
			L.TotalForce tf = new L.TotalForce(f);
			L.Mass m = new L.Mass();
			m.kg = 0.3;
			L.Acceleration a = new L.Acceleration(m,tf);
			result += Convert.ToString(a.Norm)+"   ";
			result += Convert.ToString(Math.Atan(a.Y/a.X)*180.0/Math.PI);
		}
	}
}
